
POURCENTAGE = 0.15

Calcul = {}

function round(num, idp)
   local mult = 10^(idp or 0)
   return (math.ceil(num * mult + 0.5) / mult)
end

function Calcul:getPourcentage(nb_actions, current_price)
   return round(current_price * nb_actions * POURCENTAGE / 100, 0)
end

function Calcul:isPossibleBuy(nb_actions, current_price, money)
   return (current_price * nb_actions + Calcul:getPourcentage(nb_actions, current_price) <= money)
end
